package com.xbongbong.crm.config;

import com.xbongbong.crm.abstracts.AbstractFineClueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2022/02/15 14:25
 */
@Configuration
public class FineClueServiceConfig {

    @Autowired
    private Map<String, AbstractFineClueService> fineClueServiceMap;


    @Bean("fineClueServiceMap")
    public Map<Integer, AbstractFineClueService> getFineClueMap(){
        Map<Integer, AbstractFineClueService> businessMap = new HashMap<>(fineClueServiceMap.size());
        fineClueServiceMap.forEach((key, value)->{
            value.businessList().forEach(item->{
                businessMap.put(item, value);
            });
        });
        return businessMap;
    }
}
